﻿@model List<SuperiorModel.VersionItem>
@{
    ViewBag.Title = "小程序版本管理";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<input type="hidden" id="mapRotute" map="map_versionList" />
<div class="title_ding">

    <p id="location">
        当前位置：
        小程序版本管理
    </p>
</div>
<div class="shopmain">
    <div class="shopbody">
        <div class="layui-card">
            @*<div class="layui-card-header">商城管理</div>*@
            <div class="layui-card-body">

                <div class="layui-form-item">
                    @*<label class="layui-form-label">版本</label>*@
                    <div class="layui-form" action="">
                        <div class="layui-form-item">
                            <label for="version" class="layui-form-label">
                                版本号
                            </label>
                            <div class="layui-input-inline" style="width:50%">
                                <input type="text" id="version" name="version"  class="layui-input" value="" placeholder="请输入版本号">
                            </div>

                        </div>

                        <div class="layui-form-item">
                            <label for="InitSallNum" class="layui-form-label">
                                更新内容
                            </label>
                            <div class="layui-input-inline" style="width:50%">
                                <textarea id="msg" style="width: 300px;height: 130px;" ></textarea>
                            </div>


                        </div>
                        <div class="layui-form-item" style="margin-left: 110px;">
                            <div class="layui-input-block" style="margin:0;">
                                <button id="btn_add" class="layui-btn" lay-submit lay-filter="add">添加</button>
                            </div>
                        </div>


                    </div>
                  
                </div>
                <div class="layui-form-item layui-form-text" id="dataList">
                    <table class="layui-table" lay-filter="test">
                        <thead>
                            <tr>
                                <th>版本时间</th>
                                <th>版本号</th>
                                <th>更新信息</th>
                                
                            </tr>
                        </thead>
                        <tbody>
                            @foreach (var item in Model)
                            {
                                <tr>
                                    <td>@item.CreateTime</td>
                                    <td>@item.Version</td>
                                   
                                    <td>@item.Msg</td>
                                   
                                </tr>
                            }
                        </tbody>
                    </table>
                </div>


            </div>
        </div>
    </div>
</div>


<script>
    $(document).on('click', '#btn_add', function () {
        var version = $("#version").val();
        var msg = $("#msg").val();
        if (version == "" || msg == "") {
            layer.alert("参数不能为空");
            return false;
        }
        var model = {};
        model.Version = version;
        model.Msg = msg;
        var index = layer.load(1);
        RequestManager.Ajax.Post("/Version/Add", model, true, function (data) {
            layer.close(index);
            if (data.IsSuccess) {
                layer.alert("添加成功", function () {
                    window.location.reload();
                });

            } else {
                layer.alert(data.Message);
            }
        })
    })
</script>
